<%@ include file="/WEB-INF/views/includes.jsp" %>
<%@ include file="/WEB-INF/views/header.jsp" %>
<%@ page session="false" %>

<h1>${operation} Document</h1>

<form:form commandName="document" method="POST" autocomplete="off">
	
	<form:hidden path="id" id="id" />
	
	<fieldset>
		<legend>Document Attributes</legend>
		
		<table style="width:100%;">
			<tr>
				<td style="width:150px;">File Name: </td>
				<td>
					<form:input path="fileName" id="fileName" style="width:400px;" />
					<form:errors path="fileName" cssClass="error" />
				</td>
			</tr>
			<tr>
				<td style="vertical-align:top;">Content: </td>
				<td>
					<form:textarea path="fileContent" id="fileContent" style="width:100%;" />
					<i>This would actually be a file upload/download field in real life</i>
					<form:errors path="fileContent" cssClass="error" />
				</td>
			</tr>
		</table>
	</fieldset>
	
	<fieldset style="margin-top:20px;">
		<legend>Share Document With</legend>
		<p>Select the users that you would like this document to be shared with.  <strong>Hold CTRL to select multiple users.</strong></p>
		<center>
			<select multiple="true" style="width:300px;" name="users">
				<c:forEach var="user" items="${users}">
					<option value="${user.id}">${user.name}</option>
				</c:forEach>
			</select>
		</center>
	</fieldset>

	<fieldset style="margin-top:20px;">
		<legend>Courses</legend>
		<p>Select the courses that you would like this document to be shared with. <strong>Hold CTRL to select multiple documents.</strong></p>
		<center>
			<select multiple="true" style="width:300px;" name="users">
				<c:forEach var="course" items="${courses}">
					<option value="${course.crn}">${course.code}: ${course.name}</option>
				</c:forEach>
			</select>
		</center>
	</fieldset>
	
	<div style="text-align:right;">
		<input type="submit" value="Save" />
		<input type="button" value="Cancel" onclick="javascript:window.history.go(-1);" />
	</div>

</form:form>

<%@ include file="/WEB-INF/views/footer.jsp" %>